package com.weibo4j.api.response.status;

import java.util.Arrays;
import java.util.List;

import com.alibaba.fastjson.JSONArray;
import com.weibo4j.api.WeiboResponse;

public abstract class StatusTimelineIdsResponse extends WeiboResponse<List<String>> {

	private List<String> model;

	public int getPreviousCursor() {
		return result.getIntValue("previous_cursor");
	}

	public int getNextCursor() {
		return result.getIntValue("next_cursor");
	}

	public int getTotalNumber() {
		return result.getIntValue("total_number");
	}

	@Override
	public List<String> getModel() {
		if (success && model == null) {
			isSuccess();
		}
		return model;
	}

	@Override
	public boolean isSuccess() {
		boolean isSuccess = super.isSuccess();
    	if (isSuccess && model == null) {
    		JSONArray arr = result.getJSONArray("statuses");
    		model = Arrays.asList(arr.toArray(new String[arr.size()]));
    	}
    	return isSuccess;
	}
	

}
